// Created by WXX on 2021/12/1 9:43
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

/**
 * 执行用时：4 ms, 在所有 C++ 提交中击败了79.78%的用户
 * 内存消耗：6.7 MB, 在所有 C++ 提交中击败了46.57%的用户
 */
class Solution {
public:
    int maxPower(string s) {
        int res = 1;
        for (int i = 0; i < s.size(); ) {
            int j = i + 1;
            while (j < s.size() && s[j] == s[i]) j++;
            res = max(res, j - i);
            i = j;
        }
        return res;
    }
};

int main() {

    cout << Solution().maxPower("leetcode") << endl;  // 2

    return 0;
}
